package com.xc.web.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xc.domain.pojo.SysRole;
import com.xc.domain.pojo.SysUser;
import com.xc.service.SysRoleService;
import com.xc.service.SysUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "角色的相关接口")
@RestController
@RequestMapping("/role")
public class RoleController {

    @Autowired
    private SysRoleService sysRoleService;

    @ApiOperation(value = "角色列表")
    @PreAuthorize("hasAuthority('system:role:list')")
    @GetMapping("/list")
    public Page<SysRole> list(int page, int pageSize){
        Page<SysRole> sysRolePage = sysRoleService.roleList(page, pageSize);
        return sysRolePage;
    }
}
